<template>
    <div class="common-list">
        <list-title />
        <component :is="type == 1 ? roleMenus : roleModules" ref="roleMenusRef"></component>
        <el-button type="primary" class="save" @click="saveModule">保存</el-button>
    </div>
</template>

<script setup>
import { ref, provide } from "vue";
import roleMenus from "./cpn/roleMenus.vue";
import roleModules from "./cpn/roleModules.vue";
import { useRoute } from "vue-router";

const route = useRoute();
const type = route.query.type;
console.log(type);
const roleMenusRef = ref(null);
const saveModule = () => {
    roleMenusRef.value.setMenusFn();
};

provide("title", type == 1 ? "菜单权限" : "按钮权限");
</script>

<style lang="less" scoped>
.common-list {
    position: relative;
    box-sizing: border-box;
    height: 100%;
    background-color: #fff;
    padding: 10px 20px 20px 20px;
    .save {
        position: absolute;
        right: 20px;
        bottom: 20px;
        width: 104px;
        z-index: 99;
    }
}
</style>
